proof of the dot product formula for vectors